package com.bigfire.dtm.shared.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * 值类型
 * @author Damon S.
 * @version v1.0.1
 * @date 2019年12月20日 13:31
 */
@Getter
@RequiredArgsConstructor
public enum ValueType {
    /**值类型*/
    UNKNOWN(-1),
    INTEGER(0),
    STRING(1),
    DOUBLE(2),
    BOOLEAN(3);

    private final int code;

    public static ValueType parse(int code) {
        ValueType type = UNKNOWN;
        switch (code) {
            case 0:
                type = INTEGER;
                break;
            case 1:
                type = STRING;
                break;
            case 2:
                type = DOUBLE;
                break;
            case 3:
                type = BOOLEAN;
                break;
            default:
        }
        return type;
    }
}
